﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace easysql
{
    /// <summary>
    /// 微软sqlserver数据库
    /// </summary>
    public class SqlServerDatabase:BaseDatabase
    {
        private String _connString;
        /// <summary>
        /// 通过连接字符串获得连接
        /// </summary>
        /// <param name="connString">user id=用户名;password=密码;initial catalog=数据库名;Server=服务地址</param>
        public SqlServerDatabase(String connString)
            : base("@Param","@Param")
        {
            this._connString = connString;
        }

        #region 必须重载的父类方法
        protected override System.Data.Common.DbConnection CreateConnection()
        {
            return new SqlConnection(_connString);
        }
        protected override System.Data.Common.DbDataAdapter CreateAdapter(System.Data.Common.DbCommand cmd)
        {
            return new SqlDataAdapter(cmd as SqlCommand);
        }

        protected override string AutoIncreSql()
        {
            return " select @@identity ";
        }
        #endregion 必须重载的父类方法

    }
}
